home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CD ROM Paradise Collection 4
/
CD ROM Paradise Collection 4 1995 Nov.iso
/
science
/
sm32a.zip
/
LIBRARY
/
DATAPLOT.LI
< prev
next >
Wrap
Text File
|
1994-12-22
|
1KB
|
26 lines
# library dataplot.li
# dataplot()
# plots data ( [x1,x2,...], [y1,y2,...] ) on xy-plane
# dataplot( [x1,x2,...], [y1,y2,...], xmin, xmax, ymin,ymax, link)
# plots a set of data with the linked dots if link=1,
# by default, link=0.
# e.g. dataplot([1,2,3], [1,4,9])
dataplot(x_, y_, xmin_, xmax_, ymin_, ymax_, link_) := block(numeric:=on,
dx:=(xmax-xmin)/getmaxx,
dy:=(ymax-ymin)/getmaxy,
length:=length(y),
axis(xmin,xmax,ymin,ymax),
do( circle((member(x,j)-xmin)/dx,getmaxy-(member(y,j)-ymin)/dy,2),
j,1,length,1),
setcolor(colorno(yellow)),
moveto((member(x,1)-xmin)/dx,getmaxy-(member(y,1)-ymin)/dy),
if(link,do( lineto((member(x,j)-xmin)/dx,getmaxy-(member(y,j)-ymin)/dy),
j,1,length,1)),
numeric:=off,
readchar,
local(dx,dy,length))
dataplot(x_,y_,xmin_,xmax_,ymin_,ymax_) := dataplot(x,y,xmin,xmax,ymin,ymax,0)
dataplot(x_,y_,xmin_,xmax_) := dataplot(x,y,xmin,xmax,min(y)*0.9,max(y)*1.05,0)
dataplot(x_,y_) := dataplot(x,y,min(x)*0.9,max(x)*1.05,min(y)*0.9,max(y)*1.05,0)